﻿module Sustainalytics.Shell {

    import Navigation = Sustainalytics.Navigation;


    export class SiteMapUtility {

        public static addSiteMaps(NavigationService: Navigation.INavigationService) {

            // add Site Sitemap
            NavigationService.addSiteMapNode('SITE', 'ROOT', 1,
                [
                    // HOME
                    {
                        code: 'HOME',
                        path: '/',
                        title: 'Home',
                        userData: null,
                        nodes: []
                    },

                    // PORTFOLIO
                    {
                        code: 'PORTFOLIO',
                        path: '/portfolios',
                        title: 'Portfolio',
                        userData: null,
                        nodes:
                        [
                            // PORTFOLIO_MANAGEMENT
                            {
                                code: 'PORTFOLIO_MANAGEMENT',
                                path: '/portfolios',
                                title: 'Portfolio Management',
                                userData: null,
                                nodes: [
                                    { code: 'PORTFOLIO_DETAILS', path: '/portfolios/:id', title: 'Portfolio Details', userData: null, nodes: [] }
                                ]
                            },

                            // PORTFOLIO_ANALYTICS
                            {
                                code: 'PORTFOLIO_ANALYTICS',
                                path: '/portfolios/analytics',
                                title: 'Portfolio Analytics',
                                userData: null,
                                nodes: []
                            },

                            // PORTFOLIO_MONITORING
                            {
                                code: 'PORTFOLIO_MONITORING',
                                path: '/portfolios/monitoring',
                                title: 'Portfolio Monitoring',
                                userData: null,
                                nodes: []
                            }
                        ]
                    },

                    // RESEARCH
                    {
                        code: 'RESEARCH',
                        path: '/research/company',
                        title: 'Research',
                        userData: null,
                        nodes:
                        [
                            // COMPANY
                            {
                                code: 'RESEARCH_COMPANY',
                                path: '/research/company',
                                title: 'Company',
                                userData: null,
                                nodes:
                                [
                                    // COMPANY_OVERVIEW
                                    {
                                        code: 'RESEARCH_COMPANY_OVERVIEW',
                                        path: '/research/overview/:companyName',
                                        title: 'Overview',
                                        userData: null,
                                        nodes: []
                                    },

                                    // COMPANY_ESGRATING
                                    {
                                        code: 'RESEARCH_COMPANY_ESGRATING',
                                        path: '/research/esgRatings/:companyName',
                                        title: 'ESG Rating',
                                        userData: null,
                                        nodes: []
                                    },

                                    // COMPANY_GOVERNANCE
                                    {
                                        code: 'RESEARCH_COMPANY_GOVERNANCE',
                                        path: '/research/governance/:companyName',
                                        title: 'Governance',
                                        userData: null,
                                        nodes: []
                                    },

                                    // COMPANY_COUNTRY
                                    {
                                        code: 'RESEARCH_COMPANY_COUNTRY',
                                        path: '/research/controversies/:companyName',
                                        title: 'Controversies',
                                        userData: null,
                                        nodes: []
                                    },

                                    // COMPANY_GLOBALCOMPACT
                                    {
                                        code: 'RESEARCH_COMPANY_GLOBALCOMPACT',
                                        path: '/research/globalcompact/company/:companyName/:overallAssessment?',
                                        title: 'Global Compact',
                                        userData: null,
                                        nodes: []
                                    },

                                    // COMPANY_PRODUCTS
                                    {
                                        code: 'RESEARCH_COMPANY_PRODUCTS',
                                        path: '/research/pi/:companyName',
                                        title: 'Compliance',
                                        userData: null,
                                        nodes: []
                                    }
                                ]
                            },

                            // GLOBALCOMPACT
                            {
                                code: 'RESEARCH_GLOBALCOMPACT',
                                path: '/research/globalcompact/:overallAssessment?',
                                title: 'Global Compact',
                                userData: null,
                                nodes:
                                [
                                ]
                            },

                            // PRODUCTS
                            {
                                code: 'RESEARCH_PRODUCTS',
                                path: '/research/pi',
                                title: 'Compliance',
                                userData: null,
                                nodes:
                                [
                                ]
                            }

                            // COUNTRY
                            //{
                            //    code: 'RESEARCH_COUNTRY',
                            //    path: '/research/country',
                            //    title: 'Country',
                            //    userData: null,
                            //    nodes:
                            //    [
                            //    ]
                            //},

                            // SECTOR
                            //{
                            //    code: 'RESEARCH_SECTOR',
                            //    path: '/research/sector',
                            //    title: 'Sector',
                            //    userData: null,
                            //    nodes:
                            //    [
                            //    ]
                            //}
                        ]
                    },

                    // TOOLS
                    {
                        code: 'TOOLS',
                        path: '/tools',
                        title: 'Tools',
                        userData: null,
                        nodes:
                        [
                            // TOOLS_SCREENINGTOOL
                            {
                                code: 'TOOLS_SCREENINGTOOL',
                                path: '/tools',
                                title: 'Screening Tool',
                                userData: null,
                                nodes: []
                            },

                            // TOOLS_REPORTS
                            {
                                code: 'TOOLS_REPORTS',
                                path: '/tools/reports',
                                title: 'Reports',
                                userData: null,
                                nodes: []
                            },

                            // TOOLS_ADVANCEDSEARCH
                            {
                                code: 'TOOLS_ADVANCEDSEARCH',
                                path: '/tools/advancedsearch',
                                title: 'Advanced Search',
                                userData: null,
                                nodes: []
                            }
                        ]
                    }
                ]);

            // add Dashboard Category Sitemap
            NavigationService.addSiteMapNode('CAT', 'ROOT', 1,
                [
                    {
                        code: 'NEWS', path: '/news', title: 'News', userData: { id: 'icons-spacer-bg-news', largeIcon: '../../content/images/icn-news-details-big.png' },
                        nodes: [
                            {
                                code: 'NEWSVIEW', path: '/news/:newsId', title: 'News View', userData: { id: 'icons-spacer-bg-news', largeIcon: '../../content/images/icn-news-details-big.png' },
                                nodes: []
                            }]
                    },
                    {
                        code: 'MRA', path: '/mostrecentactivity', title: 'Most Recent Activity', userData: { id: 'icons-spacer-bg-activity', largeIcon: '../../content/images/icn-activity-details-big.png' },
                        nodes: []
                    },
                    {
                        code: 'CALENDAR', path: '/events', title: 'Calendar', userData: { id: 'icons-spacer-bg-calendar', largeIcon: '../../content/images/icn-calendar-details-big.png' },
                        nodes: [
                            {
                                code: 'CALENDAR VIEW', path: '/events/date/:eventsDate', title: 'Calendar View', userData: { id: 'icons-spacer-bg-calendar', largeIcon: '../../content/images/icn-calendar-details-big.png' },
                                nodes: []
                            }]
                    },
                    {
                        code: 'MAR', path: '/mostactivereports', title: 'Most Active Reports', userData: { id: 'icons-spacer-bg-reports', largeIcon: '../../content/images/icn-reports-details-big.png' },
                        nodes: []
                    },
                    //{ code: 'PORTFOLIO', path: '', title: 'Portfolio', userData: { id: 'icons-spacer-bg-portfolio', largeIcon: '../../content/images/icn-portfolio-details-big.png' }, nodes: [] },
                    {
                        code: 'INSIGHTS', path: '/insights', title: 'Insights', userData: { id: 'icons-spacer-bg-insights', largeIcon: '../../content/images/icn-insights-details-big.png' },
                        nodes: [
                            {
                                code: 'INSIGHT VIEW', path: '/insights/:id', title: 'Insights View', userData: { id: 'icons-spacer-bg-insights', largeIcon: '../../content/images/icn-insights-details-big.png' },
                                nodes: []
                            }]
                    }
                ]);

            NavigationService.updateSiteMaps();
        }
    }
}